package com.wxtf.platform.main.sygl;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.wxtf.platform.interfaces.CommonsCallProvider;
import com.wxtf.platform.plugins.user.UserBean;
import com.wxtf.platform.supers.LogicBase;

import com.wxtf.platform.tools.ConstantInfoHelper;
import com.wxtf.platform.tools.AccessDataBaseUtil;

/**
 * <li>Title: emptongji_Action.java</li>
 * <li>Project: baseplatform</li>
 * <li>Package: com.wxtf.platform.main.sygl</li>
 * <li>Description: 生育情况统计表</li>
 * <li>Copyright: Copyright (c) 2012</li>
 * <li>Company: wxthtf Technologies </li>
 * <li>Created on Aug 21, 2012 10:29:02 AM</li>
 * 
 * @author wangli
 * @version 1.0.0.0
 * 
 */
public class emptongji_Action extends LogicBase implements
		CommonsCallProvider {
	private static final Log log = LogFactory
			.getLog(emptongji_Action.class);

	public emptongji_Action(String jsonArray) {

	}

	@Override
	public Object run() {
		Object msg = "";
		try {
			if("queryPage".equals(this.getMethodName())) {//家庭信息
				msg = this.select(this.getLogicData());
			} else if("queryEmployee".equals(this.getMethodName())){
				msg = this.select_tem(this.getLogicData());//员工信息
			}
			else{
				msg = "\"没有【" + this.getMethodName() + "】该方法\"";
			}

			if(msg == null || "[null]".equals(msg)) {
				msg = "\"\"";
			}
			if(msg.toString().startsWith("{") || msg.toString().startsWith("[")){
				return msg;
			}
			msg = ConstantInfoHelper.generateJSONString(msg.toString());
		} catch (Exception e) {
			msg = ConstantInfoHelper.generateErrorJSONString();
			log.error(e, e);
		} finally {
			this.clear();
		}
		return msg.toString();
	}


	@Override
	public Object select(Object jsonArray) throws Exception {
		UserBean user = (UserBean) this.getRequest().getSession().getAttribute("userBean");

		Object[] params = null;
		JSONArray array = JSONArray.fromObject(jsonArray);
		if(array.size() > 0) {
			JSONObject jsonObject = JSONObject.fromObject(array.getString(0));
			String type = jsonObject.getString("type");
			String orgIds = jsonObject.getString("orgIds");//机构ID串身份证
			StringBuffer buff = new StringBuffer();
			//System.out.println("orgIds:"+orgIds);
			if("record".equals(type)) {// 独生子女办证【应办证】
				buff.append(" from (SELECT o.tbeocr_id,t.tbe_id,s.org_id,s.reserve1,s.tbe_spell_code,s.tbe_idcard,s.tbe_work_permit,s.tbe_name,s.tbe_sex,s.tbe_age,")
					.append("s.tbe_birthday,s.tbe_position,s.tbe_native_palce,s.tbe_family_phone,s.tbe_address,s.tbe_marital_status,s.tbe_marital_condition,")
					.append("s.tbe_is_again_birth,s.tbe_is_barrenness,s.tbe_is_late_marriage,s.tbe_is_late_birth,s.tbe_status,t.tbfi_id,t.tbe_spouse_id,")
					.append("t.tbfi_spouse_name,t.tbfi_spouse_sex,t.tbfi_spouse_age,t.tbfi_spouse_birthday,t.tbfi_spouse_idcard,t.tbfi_spouse_department,")
					.append("t.tbfi_spouse_position,t.tbfi_spouse_is_join,t.tbfi_phone,t.tbfi_mobile,t.tbfi_address,t.tbfi_peo_num,t.tbfi_children_num,")
					.append("t.tbfi_children_mnum,t.tbfi_children_fnum,t.tbfi_memo")
					.append(" from tb_family_base t LEFT JOIN tb_employee s on t.tbe_id=s.tbe_id LEFT JOIN tbe_only_child_record o on t.tbfi_id=o.tbfi_id where s.tbe_employment_forms <> '31' and t.tbfi_children_num = 1 and tbe_status not in('102-4','102-3'))t where 1 = 1 ");
			} else if("recorded".equals(type)) {// 【已办证】
				buff.append(" from (SELECT o.tbeocr_id,t.tbe_id,s.org_id,s.reserve1,s.tbe_spell_code,s.tbe_idcard,s.tbe_work_permit,s.tbe_name,s.tbe_sex,s.tbe_age,")
					.append("s.tbe_birthday,s.tbe_position,s.tbe_native_palce,s.tbe_family_phone,s.tbe_address,s.tbe_marital_status,s.tbe_marital_condition,")
					.append("s.tbe_is_again_birth,s.tbe_is_barrenness,s.tbe_is_late_marriage,s.tbe_is_late_birth,s.tbe_status,t.tbfi_id,t.tbe_spouse_id,")
					.append("t.tbfi_spouse_name,t.tbfi_spouse_sex,t.tbfi_spouse_age,t.tbfi_spouse_birthday,t.tbfi_spouse_idcard,t.tbfi_spouse_department,")
					.append("t.tbfi_spouse_position,t.tbfi_spouse_is_join,t.tbfi_phone,t.tbfi_mobile,t.tbfi_address,t.tbfi_peo_num,t.tbfi_children_num,")
					.append("t.tbfi_children_mnum,t.tbfi_children_fnum,t.tbfi_memo")
					.append(" from tb_family_base t LEFT JOIN tb_employee s on t.tbe_id=s.tbe_id LEFT JOIN tbe_only_child_record o on t.tbfi_id=o.tbfi_id where o.reserve2<>'1' and tbeocr_id <> '' and s.tbe_employment_forms <> '31' and t.tbfi_children_num = 1 and tbe_status not in('102-4','102-3'))t where 1 = 1 ");			
			} else if("recording".equals(type)) {// 【未办证】
				buff.append(" from (SELECT o.tbeocr_id,t.tbe_id,s.org_id,s.reserve1,o.reserve2,s.tbe_spell_code,s.tbe_idcard,s.tbe_work_permit,s.tbe_name,s.tbe_sex,s.tbe_age,")
					.append("s.tbe_birthday,s.tbe_position,s.tbe_native_palce,s.tbe_family_phone,s.tbe_address,s.tbe_marital_status,s.tbe_marital_condition,")
					.append("s.tbe_is_again_birth,s.tbe_is_barrenness,s.tbe_is_late_marriage,s.tbe_is_late_birth,s.tbe_status,t.tbfi_id,t.tbe_spouse_id,")
					.append("t.tbfi_spouse_name,t.tbfi_spouse_sex,t.tbfi_spouse_age,t.tbfi_spouse_birthday,t.tbfi_spouse_idcard,t.tbfi_spouse_department,")
					.append("t.tbfi_spouse_position,t.tbfi_spouse_is_join,t.tbfi_phone,t.tbfi_mobile,t.tbfi_address,t.tbfi_peo_num,t.tbfi_children_num,")
					.append("t.tbfi_children_mnum,t.tbfi_children_fnum,t.tbfi_memo")
					.append(" from tb_family_base t LEFT JOIN tb_employee s on t.tbe_id=s.tbe_id LEFT JOIN tbe_only_child_record o on t.tbfi_id=o.tbfi_id where s.tbe_employment_forms <> '31' and t.tbfi_children_num = 1 and tbe_status not in('102-4','102-3'))t where (reserve2='1' or tbeocr_id is null)");
			} else if("preg0".equals(type)) {// 【怀孕】
				buff.append(" from(SELECT t.tbe_id,s.org_id,s.reserve1,s.tbe_spell_code,s.tbe_idcard,s.tbe_work_permit,s.tbe_name,s.tbe_sex,s.tbe_age,")
					.append("s.tbe_birthday,s.tbe_position,s.tbe_native_palce,s.tbe_family_phone,s.tbe_address,s.tbe_marital_status,s.tbe_marital_condition,")
					.append("s.tbe_is_again_birth,s.tbe_is_barrenness,s.tbe_is_late_marriage,s.tbe_is_late_birth,s.tbe_status,t.tbfi_id,t.tbe_spouse_id,")
					.append("t.tbfi_spouse_name,t.tbfi_spouse_sex,t.tbfi_spouse_age,t.tbfi_spouse_birthday,t.tbfi_spouse_idcard,t.tbfi_spouse_department,")
					.append("t.tbfi_spouse_position,t.tbfi_spouse_is_join,t.tbfi_phone,t.tbfi_mobile,t.tbfi_address,t.tbfi_peo_num,t.tbfi_children_num,")
					.append("t.tbfi_children_mnum,t.tbfi_children_fnum,t.tbfi_memo,p.tbepr_option,n.tbenm_plan_status,n.reserve4,n.reserve5")
					.append(" from tbe_pregnancy_record p LEFT JOIN tbe_neonate_main n ON p.tbepr_id=n.tbepr_id ")
					.append(" LEFT JOIN tb_family_base t ON t.tbfi_id=p.tbfi_id LEFT JOIN tb_employee s ON t.tbe_id=s.tbe_id where s.tbe_status not in('102-5','102-4','102-3') and tbepr_option='0'")
					.append(")t where 1=1 and (reserve5 is NULL or reserve5 <> '1')");
			} else if("preg1".equals(type)) {// 【等孕】
				buff.append(" from(SELECT t.tbe_id,s.org_id,s.reserve1,s.tbe_spell_code,s.tbe_idcard,s.tbe_work_permit,s.tbe_name,s.tbe_sex,s.tbe_age,")
					.append("s.tbe_birthday,s.tbe_position,s.tbe_native_palce,s.tbe_family_phone,s.tbe_address,s.tbe_marital_status,s.tbe_marital_condition, ")
					.append("s.tbe_is_again_birth,s.tbe_is_barrenness,s.tbe_is_late_marriage,s.tbe_is_late_birth,s.tbe_status,t.tbfi_id,t.tbe_spouse_id,")
					.append("t.tbfi_spouse_name,t.tbfi_spouse_sex,t.tbfi_spouse_age,t.tbfi_spouse_birthday,t.tbfi_spouse_idcard,t.tbfi_spouse_department,")
					.append("t.tbfi_spouse_position,t.tbfi_spouse_is_join,t.tbfi_phone,t.tbfi_mobile,t.tbfi_address,t.tbfi_peo_num,t.tbfi_children_num,")
					.append("t.tbfi_children_mnum,t.tbfi_children_fnum,t.tbfi_memo,p.tbepr_option,n.tbenm_plan_status,n.reserve4,n.reserve5")
					.append(" from tbe_pregnancy_record p LEFT JOIN tbe_neonate_main n ON p.tbepr_id=n.tbepr_id ")
					.append(" LEFT JOIN tb_family_base t ON t.tbfi_id=p.tbfi_id LEFT JOIN tb_employee s ON t.tbe_id=s.tbe_id where s.tbe_status not in('102-5','102-4','102-3') and tbepr_option='1' ")
					.append(")t where 1=1 and (reserve5 is NULL or reserve5 <> '1')");				
			}
			if(StringUtils.isNotBlank(orgIds)){
				buff.append(" and t.org_id in (").append(user.getCurSubOrgIds(orgIds)).append(")");
			}
			// 排序
			String sortname = this.getRequest().getParameter("sortname");
			String sortorder = this.getRequest().getParameter("sortorder");
			if(sortname != null && sortname != null) {
				buff.append(" order by ").append(sortname).append(" ").append(sortorder);
			}
			sql = buff.toString();
		}
		
		String countSql = "select count(*) " + sql;
		String querySql = "select tbe_id,org_id,tbe_spell_code,tbe_idcard,tbe_work_permit,tbe_name,tbe_sex,tbe_age,tbe_birthday,tbe_position, " +
				"tbe_native_palce, tbe_family_phone, tbe_address, tbe_is_again_birth, tbe_is_barrenness, tbe_is_late_marriage,tbe_is_late_birth, " +
				"tbe_status, tbfi_id, tbe_spouse_id, tbfi_spouse_name, tbfi_spouse_sex,tbfi_spouse_age, tbfi_spouse_birthday, tbfi_spouse_idcard, tbfi_spouse_department,tbfi_spouse_position, tbfi_spouse_is_join, tbfi_phone, tbfi_mobile, tbfi_address," +
				"tbe_marital_status,tbe_marital_condition,tbfi_peo_num, tbfi_children_num, tbfi_children_mnum, tbfi_children_fnum, tbfi_memo,reserve1 " + sql;
		
		String[] fields = { "tbe_id", "org_id", "tbe_spell_code","tbe_idcard", "tbe_work_permit", "tbe_name", "tbe_sex",
				"tbe_age", "tbe_birthday","tbe_position", "tbe_native_palce", "tbe_family_phone", "tbe_address",  "tbe_is_again_birth",
				 "tbe_is_barrenness", "tbe_is_late_marriage","tbe_is_late_birth", "tbe_status","tbfi_id", "tbe_spouse_id","tbfi_spouse_name",
				 "tbfi_spouse_sex","tbfi_spouse_age", "tbfi_spouse_birthday", "tbfi_spouse_idcard", "tbfi_spouse_department",
				"tbfi_spouse_position", "tbfi_spouse_is_join", "tbfi_phone", "tbfi_mobile", "tbfi_address","tbe_marital_status",
				"tbe_marital_condition","tbfi_peo_num", "tbfi_children_num", "tbfi_children_mnum", "tbfi_children_fnum", "tbfi_memo","reserve1"};
		
		//System.out.println("fam:"+querySql);
		return AccessDataBaseUtil.query4SQLPagging(fields, countSql, querySql, this.getPage(), this.getPagesize(), params);
	}

	///查询员工信息
	public Object select_tem(Object jsonArray) throws Exception {
		UserBean user = (UserBean) this.getRequest().getSession().getAttribute("userBean");
		Object[] params = null;
		JSONArray array = JSONArray.fromObject(jsonArray);
		if(array.size() > 0) {
			JSONObject jsonObject = JSONObject.fromObject(array.getString(0));
			String type = jsonObject.getString("type");
			String orgIds = jsonObject.getString("orgIds");//机构ID串身份证

			StringBuffer buff = new StringBuffer();
			//System.out.println("type:"+type);
			if("total".equals(type)) {//所有已婚育龄职工
				//已婚育龄男1.无妻子：离异，丧偶 2.有妻子：妻子年龄20-49
				buff.append(" from (select e.* FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where ")
					.append("(tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323') or f.tbfi_spouse_birthday is null")
					.append(" or (f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男'")
					.append(" UNION ")
				//已婚育龄女//年龄20-49
					.append("select * FROM tb_employee where ")
					.append("tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and tbe_employment_forms <> '31' and tbe_sex='女' and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR))e where 1=1 ");
			} else if("totalm".equals(type)) {// 男员工
				buff.append(" FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where ")
					.append("(tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323')  or f.tbfi_spouse_birthday is null")
					.append(" or (f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男' ");

			} else if("totalf".equals(type)) {// 女员工
				buff.append(" FROM tb_employee e where e.tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='女' and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)");
			}else if("no".equals(type)) {// 无生育条件人数
				//已婚育龄无生育男【离异，丧偶，不孕症】妻子年龄20-49
				buff.append(" from (select e.* FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where")
					.append(" (tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323') or (((f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)) or f.tbfi_spouse_birthday is null) and tbe_is_barrenness='1'))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男' ")
					//已婚育龄无生育女
					.append(" UNION")
					.append(" select * FROM tb_employee where tbe_id not in (SELECT tbe_id from tb_employee where tbe_is_barrenness='0' and the_is_menopause='0'")
					.append(" and tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A321','EC88549D43494FFE8E277192921D7617')) and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR) ")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and tbe_employment_forms <> '31' and tbe_sex='女')e where 1=1 ");
			}else if("nom".equals(type)) {// 无生育条件人数男员工
				buff.append(" FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where")
					.append(" (tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323') or (((f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)) or f.tbfi_spouse_birthday is null) and tbe_is_barrenness='1'))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男' ");
			}else if("nof".equals(type)) {// 无生育条件人数女员工
				buff.append(" FROM tb_employee e where e.tbe_id not in (SELECT tbe_id from tb_employee where tbe_is_barrenness='0' and the_is_menopause='0'")
					.append(" and tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A321','EC88549D43494FFE8E277192921D7617')) and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR) ")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and tbe_employment_forms <> '31' and tbe_sex='女'");
			}else if("have".equals(type)) {// 有生育条件人数
				//已婚育龄有生育男
				buff.append(" from (select e.* FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where")
					.append(" (tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323') and (((f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)) or f.tbfi_spouse_birthday is null) and tbe_is_barrenness='0'))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男' ")
							//已婚育龄有生育女
					.append(" UNION")
					.append(" select * FROM tb_employee where tbe_id in (SELECT tbe_id from tb_employee where tbe_is_barrenness='0' and the_is_menopause='0'")
					.append(" and tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A321','EC88549D43494FFE8E277192921D7617')) and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR) ")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and tbe_employment_forms <> '31' and tbe_sex='女')e where 1=1 ");
			}else if("havem".equals(type)) {// 有生育条件人数男员工
				buff.append(" FROM tb_employee e LEFT JOIN tb_family_base f ON e.tbe_id=f.tbe_id where")
					.append(" (tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A322','8A90F0D0176C4961B322BEB26703A323') and (((f.tbfi_spouse_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and f.tbfi_spouse_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR)) or f.tbfi_spouse_birthday is null) and tbe_is_barrenness='0'))")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and e.tbe_employment_forms <> '31' and e.tbe_sex='男' ");

			}else if("havef".equals(type)) {// 有生育条件人数女员工
				buff.append(" FROM tb_employee e where e.tbe_id in (SELECT tbe_id from tb_employee where tbe_is_barrenness='0' and the_is_menopause='0'")
					.append(" and tbe_marital_status in ('8A90F0D0176C4961B322BEB26703A321','EC88549D43494FFE8E277192921D7617')) and tbe_birthday <= DATE_SUB(curdate(),INTERVAL 20 YEAR) and tbe_birthday >= DATE_SUB(curdate(),INTERVAL 49 YEAR) ")
					.append(" and tbe_marital_status not in ('8A90F0D0176C4961B322BEB26703A320') and tbe_status not in('102-5','102-4','102-3')")
					.append(" and tbe_employment_forms <> '31' and tbe_sex='女'");				
			}
			if(StringUtils.isNotBlank(orgIds)){
				buff.append(" and e.org_id in (").append(user.getCurSubOrgIds(orgIds)).append(")");
			}
			// 排序
			String sortname = this.getRequest().getParameter("sortname");
			String sortorder = this.getRequest().getParameter("sortorder");
			if(sortname != null && sortname != null) {
				buff.append(" order by ").append(sortname).append(" ").append(sortorder);
			}
			sql = buff.toString();
		}
		
		String countSql = "select count(*) " + sql;
		String querySql = "select e.tbe_id,e.org_id,e.tbe_idcard,e.tbe_work_permit,e.tbe_employment_forms,e.tbe_name,e.tbe_former_name,e.tbe_spell_code,e.tbe_sex,e.tbe_age,e.tbe_birthday,e.tbe_nation,e.tbe_native_palce,e.tbe_birthplace,e.tbe_join_time,e.tbe_seniority,e.tbe_family_phone,e.tbe_mobile,e.tbe_address,e.tbe_marital_status,e.tbe_marital_condition,e.tbe_married_time,e.tbe_marriage_certificate,e.tbe_political_status,e.tbe_qualification,e.tbe_graduate_college,e.tbe_major,e.tbe_work_area,e.tbe_position,e.tbe_is_again_birth,e.tbe_is_barrenness,e.the_is_menopause,e.tbe_is_late_marriage,e.tbe_is_late_birth,e.tbe_status,e.tbe_ba_status,e.tbe_birth_control_measures,e.tbe_es_time,e.tbe_is_es,e.tbe_es_reason,e.tbe_children_status,e.tbe_order,e.tbe_memo,e.reserve1,e.reserve2,e.reserve3,e.reserve4,e.reserve5,e.create_by,e.create_time,e.last_modify_by,e.last_modify_time " + sql;
		String[] fields = {"tbe_id","org_id","tbe_idcard","tbe_work_permit",
				"tbe_employment_forms","tbe_name","tbe_former_name","tbe_spell_code","tbe_sex","tbe_age","tbe_birthday","tbe_nation","tbe_native_palce",
				"tbe_birthplace","tbe_join_time","tbe_seniority","tbe_family_phone","tbe_mobile","tbe_address","tbe_marital_status","tbe_marital_condition",
				"tbe_married_time","tbe_marriage_certificate","tbe_political_status","tbe_qualification","tbe_graduate_college","tbe_major","tbe_work_area",
				"tbe_position","tbe_is_again_birth","tbe_is_barrenness","the_is_menopause","tbe_is_late_marriage","tbe_is_late_birth","tbe_status","tbe_ba_status",
				"tbe_birth_control_measures","tbe_es_time","tbe_is_es","tbe_es_reason","tbe_children_status","tbe_order","tbe_memo",
				"reserve1","reserve2","reserve3","reserve4","reserve5","create_by","create_time","last_modify_by","last_modify_time"
		};
		//System.out.println("emp:"+querySql);
		return AccessDataBaseUtil.query4SQLPagging(fields, countSql, querySql, this.getPage(), this.getPagesize(), params);
	}

	
	@Override
	public Object insert(Object jsonArray) throws Exception {
		return null;
	}

	@Override
	public Object update(Object jsonArray) throws Exception {
		return null;
	}

	@Override
	public Object delete(Object jsonArray) throws Exception {
		return null;
	}

	@Override
	public Object recordCount(Object jsonArray) throws Exception {
		return null;
	}

	@Override
	public Object setRequest(HttpServletRequest request) throws Exception {
		this.request = request;
		return request;
	}

	@Override
	public Object updateBatch(Object jsonArray) throws Exception {
		return null;
	}

	@Override
	public Object onCreate(Object jsonArray) {
		return null;
	}

	@Override
	public Object onDestory(Object jsonArray) {
		return null;
	}

	@Override
	public Object onInit(Object jsonArray) {
		return null;
	}
}